home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
gfx
/
pbm
/
hpcd2ppm_0_5_pl1.lha
/
hpcdtoppm.0.5.pl1
/
src
/
Adding_code
next >
Wrap
Text File
|
1993-08-20
|
2KB
|
67 lines
Several people were changing the output image format
of the decoder or asked for a different output format.
pbmplus enables the transformation to every image
format, but sometimes it is better to have the
format "inside". Therefore v0.5 is able to keep several
format 'drivers'.
To add a new output format:
- Append a new tag to the enum type OUTFOR in hpcdtoppm.h
- change O_DEFAULT to this tag in config.h if you want to
have this format as the default format.
- Insert a new 'if(...){...}' contruct to the procedure
parseargs in main.c after the comment "Output options".
- Insert description text to error.c and hpcdtoppm.man.
- If your format needs only grayscale data, append your
tag to the line "monochrome=(outfor==O_PGM)|| ..."
in the main procedure in main.c .
- If your format uses the paper size values, append your
tag to the line "paper=(outfor==O_PS)|| ..."
in the main procedure in main.c .
- Insert your tag into the switch-statement in the
procedure colconvert in color.c. If you need a
8-bit-grayscale or 24-bit-rgb model, you just
have to insert a "case O_YourTag :" . Otherwise
you have to write your own colorconversion.
- Insert your tag and procedure name into the switch-
statement in the procedure writepicture in output.c.
If you have a three-plane-image you can use the do_3plane
procedure with a pointer to your format writing
procedure as the first argument, if you have one
image plane, use the do_1plane. Otherwise write
a similar do_nplane procedure.
- Write a procedure, which produces your format. You
should use the parameter scheme as defined for the
driver types OUT3PL and OUT1PL in hpcdtoppm.h.
This means:
- a FILE *pointer to the output file
- image width and height.
- for each image plane the triple:
- a pointer to the upper left position
- a relative row step ( in bytes )
- a relative column step ( in bytes )
- If it works, let me know it. :-) Send mail to
danisch@ira.uka.de .
Hadmut